﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using CRMBiz.DataImportHandler;

namespace CRMWeb.Pages.Test
{
    public partial class TestMaxfundingJson : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void Unnamed1_Click(object sender, EventArgs e)
        {
            string jstring = txtJsonstring.Text;//"{'crm_application':[{'app_id':'30','NoInApplication':'1','DesiredAmount':'2345','PurposeSummary':'Business','Assets':'Motor Vehicle(s)','ReferrerID':'0','ReferrerVal':'','CreatedDate':'2014-01-14','EditDate':'0000-00-00 00:00:00','comesfrom':'','IsUSB':'','CreatedTime':'00:08:38','loanpurposereason':'Business cash flow','filledout':'','prevclient':'','purposedetail':'1234','boardingfee':'0','livingfee':'','totalincome':'','totalexpense':'0','totalexpensecorrect':'0','disposableincome':'','ELA':'$2345','formviewnotice':'','whyus':'','timecost':'7','preappcode':'','mc_ipaddress':'192.168.1.102','mc_income_status':'Pass','mc_asset_status':'Pass','mc_credit_status':'Pass','mc_final_status':'Pass','mc_purposeType':'Business','mc_OtherPurpose':'1234','mc_browser':'Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/31.0.1650.63 Safari/537.36','mc_referrer_company':'','mc_referrer_email':'','template':'','afterpage':'http://morganfinance.com.au/complete7.php?name=Aaaaa&ela=$2345&businessStage=Established u2013 Operated for over 12 months&borrowmore=1&car=1&residential=renting&LoanAmount=2345&property=0'}],'crm_business':[{'BusinessID':'30','AppID':'30','Stage':'Established u2013 Operated for over 12 months','Entity':'Sole trader','Relationship1':'','Relationship2':'','ABN':'','Nature':'123','Address':'123 Blues Point Road, McMahons Point, New Sou','Website':'','MoneyDetail':'','Income':'123','Repay':'123','RepayBy':'Business cash flow','Trustee':'','Beneficiary':'','CashSale':'','EftposSale':'','UsbYear':'','UsbMonth':'','CompanyName':'123'}],'crm_contact':[{'ContactID':'35','FirstName':'Aaaaa','MiddleName':'','SurName':'BBBBB','Title':'Mr','Gender':'gender','Mobile':'0411 111 111','HomePhone':'02 1111 1111','Email':'abc@aaa.com','DriverLicense':'','Citizenship':'Australian - Born in Australia','DateBirth':'15/01/1981','StreetNo':'','Street':'23 Victoria Road','Suburb':'Bellevue Hill','State':'NSW','PostCode':'2023','Dependant':'','app_ResidentialStatus':'renting','app_id':'30','NumberFromAppinfo':'1','Relationship':''}],'crm_applicationcredit':[{'appcredit_id':'35','app_id':'30','credit_hardship':'','credit_gambling':'','credit_claims':'No','credit_history':'1 default','credit_outstanding':'1234','credit_dischargedate':'','credit_discharge':'','WhyChooseMF':null,'ExistingClient':null,'CurrentContact_id':'35'}],'crm_income':[{'appincome_id':'30','app_id':'30','income_aftertax':'123','income_aftertax_period':'','income_centrelink':'0','income_other':'0','income_other_period':'','income_rental':'','income_total':'','CreatedDate':'0000-00-00','EditDate':'0000-00-00','OtherIncomeSpecify':'','income_other_type':'value-13','CurrentContact_id':'35'}],'crm_vehicle':[{'VehicleID':'33','AppID':'30','Brand':'123','Model':'123','Owner':'123','Finance':'No','VehicleYear':'2012','Insurance':'3rd Party Property','VehicleValue':'12345','VehicleOwing':'','VehicleLender':'','VehiclePayment':'0'}]}";
            string insertstr =jstring.Replace("\"", "\'");

            if (GetDataFromMfFHandler.checkApplicationExist(insertstr, "Jennifer")) 
                Response.Write("CRM_Success");
            else
                Response.Write("CRM_INSERT_ERROR");
           
        }
    }
}